package cn.shutdown.autocompletetextviewtest;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.MultiAutoCompleteTextView;

public class MainActivity extends Activity {
	AutoCompleteTextView actv;
	MultiAutoCompleteTextView mactv;
	String[] books = new String[] { "book1", "book2", "book3", "book4" };

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		ArrayAdapter<String> aa = new ArrayAdapter<String>(this,
				android.R.layout.simple_dropdown_item_1line, books);
		actv = (AutoCompleteTextView) findViewById(R.id.auto);
		actv.setAdapter(aa);
		mactv = (MultiAutoCompleteTextView) findViewById(R.id.multi);
		mactv.setAdapter(aa);
		mactv.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
